<html>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<head>
<title>Section 1.3.&nbsp; Logging In</title>
<link rel="STYLESHEET" type="text/css" href="images/style.css">
<link rel="STYLESHEET" type="text/css" href="images/docsafari.css">
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td><div STYLE="MARGIN-LEFT: 0.15in;"><a href="toc.html"><img src="images/team.gif" width="60" height="17" border="0" align="absmiddle"  alt="Team BBL"></a></div></td>
<td align="right"><div STYLE="MARGIN-LEFT: 0.15in;">
<a href=ch01lev1sec2.html><img src="images/prev.gif" width="60" height="17" border="0" align="absmiddle" alt="Previous Page"></a>
<a href=ch01lev1sec4.html><img src="images/next.gif" width="60" height="17" border="0" align="absmiddle" alt="Next Page"></a>
</div></td></tr></table>
<br><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td valign="top"><a name="ch01lev1sec3"></a>
<h3 class="docSection1Title">1.3. Logging In</h3>
<a name="ch01lev2sec1"></a>
<H4 class="docSection2Title">Login Name</H4>
<p class="docText">When we log in to a UNIX system, we enter our login name, followed by our password. The system then looks up our login name in its password file, usually the file <tt>/etc/passwd</tt>. If we look at our entry in the password file we see that it's composed of seven colon-separated fields: the login name, encrypted password, numeric user ID (205), numeric group ID (105), a comment field, home directory (<tt>/home/sar</tt>), and shell program (<tt>/bin/ksh</tt>).</p>

<pre>
   sar:x:205:105:Stephen Rago:/home/sar:/bin/ksh
</pre><BR>

<p class="docText">All contemporary systems have moved the encrypted password to a different file. In <a class="docLink" href="ch06.html#ch06">Chapter 6</a>, we'll look at these files and some functions to access them.</P>

<a name="ch01lev2sec2"></a>
<H4 class="docSection2Title">Shells</h4>
<p class="docText"><a name="idd1e1705"></a><a name="idd1e1708"></a><a name="idd1e1711"></a><a name="idd1e1714"></a><a name="idd1e1717"></a><a name="idd1e1720"></a><a name="idd1e1723"></a><a name="idd1e1726"></a><a name="idd1e1729"></a><a name="idd1e1732"></a><a name="idd1e1737"></a><a name="idd1e1740"></a><a name="idd1e1743"></a><a name="idd1e1746"></a>Once we log in, some system information messages are typically displayed, and then we can type commands to the shell program. (Some systems start a window management program when you log in, but you generally end up with a shell running in one of the windows.) A <span class="docEmphasis">shell</span> is a command-line interpreter that reads user input and executes commands. The user input to a shell is normally from the terminal (an interactive shell) or sometimes from a file (called a <span class="docEmphasis">shell script</span>). The common shells in use are summarized in <a class="docLink" href="#ch01fig02">Figure 1.2</a>.</P>
<a name="ch01fig02"></a><P><table cellspacing="0" class="allBorders" border="1" RULES="groups" cellpadding="5"><caption><H5 class="docTableTitle">Figure 1.2. Common shells used on UNIX systems</h5></caption><colgroup><col width="125"><col width="80"><col width="80"><col width="80"><col width="80"><col width="80"></colgroup><thead><TR><th class="rightBorder bottomBorder thead" scope="col" align="center" valign="bottom"><p class="docText"><span class="docEmphRoman">Name</span></p></th><th class="rightBorder bottomBorder thead" scope="col" align="center" valign="bottom"><p class="docText"><span class="docEmphRoman">Path</span></P></th><th class="rightBorder bottomBorder thead" scope="col" align="center" valign="bottom"><p class="docText"><span class="docEmphRoman">FreeBSD 5.2.1</span></P></th><th class="rightBorder bottomBorder thead" scope="col" align="center" valign="bottom"><p class="docText"><span class="docEmphRoman">Linux 2.4.22</span></P></th><th class="rightBorder bottomBorder thead" scope="col" align="center" valign="bottom"><p class="docText"><span class="docEmphRoman">Mac OS X 10.3</span></p></th><th class="bottomBorder thead" scope="col" align="center" valign="bottom"><p class="docText"><span class="docEmphRoman">Solaris 9</span></P></th></TR></thead><tr><TD class="rightBorder" align="left" valign="top"><p class="docText">Bourne shell</P></td><td class="rightBorder" align="left" valign="top"><p class="docText"><tt>/bin/sh</tt></p></td><TD class="rightBorder" align="center" valign="top"><p class="docText">&#8226;</p></TD><td class="rightBorder" align="center" valign="top"><p class="docText">link to <tt>bash</tt></P></td><td class="rightBorder" align="center" valign="top"><p class="docText">link to <tt>bash</tt></p></td><td class="docTableCell" align="center" valign="top"><p class="docText">&#8226;</p></td></tr><tr><td class="rightBorder" align="left" valign="top"><p class="docText">Bourne-again shell</p></td><td class="rightBorder" align="left" valign="top"><p class="docText"><tt>/bin/bash</tt></p></td><td class="rightBorder" align="center" valign="top"><p class="docText">optional</p></TD><TD class="rightBorder" align="center" valign="top"><p class="docText">&#8226;</p></TD><TD class="rightBorder" align="center" valign="top"><p class="docText">&#8226;</P></td><TD class="docTableCell" align="center" valign="top"><p class="docText">&#8226;</P></TD></tr><TR><td class="rightBorder" align="left" valign="top"><p class="docText">C shell</P></TD><TD class="rightBorder" align="left" valign="top"><p class="docText"><tt>/bin/csh</tt></p></TD><TD class="rightBorder" align="center" valign="top"><p class="docText">link to <tt>tcsh</tt></p></TD><TD class="rightBorder" align="center" valign="top"><p class="docText">link to <tt>tcsh</tt></p></td><td class="rightBorder" align="center" valign="top"><p class="docText">link to <tt>tcsh</tt></p></TD><td class="docTableCell" align="center" valign="top"><p class="docText">&#8226;</P></td></TR><tr><td class="rightBorder" align="left" valign="top"><p class="docText">Korn shell</p></td><td class="rightBorder" align="left" valign="top"><p class="docText"><tt>/bin/ksh</tt></p></td><td class="rightBorder" align="center" valign="top"><p class="docText"></p></td><td class="rightBorder" align="center" valign="top"><p class="docText"></p></td><td class="rightBorder" align="center" valign="top"><p class="docText"></p></td><td class="docTableCell" align="center" valign="top"><p class="docText">&#8226;</P></TD></tr><TR><TD class="rightBorder" align="left" valign="top"><p class="docText">TENEX C shell</P></td><TD class="rightBorder" align="left" valign="top"><p class="docText"><tt>/bin/tcsh</tt></P></TD><td class="rightBorder" align="center" valign="top"><p class="docText">&#8226;</P></td><TD class="rightBorder" align="center" valign="top"><p class="docText">&#8226;</P></TD><td class="rightBorder" align="center" valign="top"><p class="docText">&#8226;</P></TD><td class="docTableCell" align="center" valign="top"><p class="docText">&#8226;</P></TD></tr></table></p><br>
<p class="docText">The system knows which shell to execute for us from the final field in our entry in the password file.</p>
<p class="docText">The Bourne shell, developed by Steve Bourne at Bell Labs, has been in use since Version 7 and is provided with almost every UNIX system in existence. The control-flow constructs of the Bourne shell are reminiscent of Algol 68.</P>
<p class="docText">The C shell, developed by Bill Joy at Berkeley, is provided with all the BSD releases. Additionally, the C shell was provided by AT&amp;T with System V/386 Release 3.2 and is also in System V Release 4 (SVR4). (We'll have more to say about these different versions of the UNIX System in the next chapter.) The C shell was built on the 6th Edition shell, not the Bourne shell. Its control flow looks more like the C language, and it supports additional features that weren't provided by the Bourne shell: job control, a history mechanism, and command line editing.</p>
<p class="docText">The Korn shell is considered a successor to the Bourne shell and was first provided with SVR4. The Korn shell, developed by David Korn at Bell Labs, runs on most UNIX systems, but before SVR4 was usually an extra-cost add-on, so it is not as widespread as the other two shells. It is upward compatible with the Bourne shell and includes those features that made the C shell popular: job control, command line editing, and so on.</P>
<p class="docText">The Bourne-again shell is the GNU shell provided with all Linux systems. It was designed to be POSIX-conformant, while still remaining compatible with the Bourne shell. It supports features from both the C shell and the Korn shell.</p>
<p class="docText">The TENEX C shell is an enhanced version of the C shell. It borrows several features, such as command completion, from the TENEX operating system (developed in 1972 at Bolt Beranek and Newman). The TENEX C shell adds many features to the C shell and is often used as a replacement for the C shell.</P>
<blockquote>
<p class="docText">Linux uses the Bourne-again shell for its default shell. In fact, <tt>/bin/sh</tt> is a link to <tt>/bin/bash</tt>. The default user shell in FreeBSD and Mac OS X is the TENEX C shell, but they use the Bourne shell for their administrative shell scripts because the C shell's programming <a name="idd1e1993"></a><a name="idd1e1999"></a><a name="idd1e2005"></a><a name="idd1e2010"></a><a name="idd1e2013"></a><a name="idd1e2018"></a><a name="idd1e2023"></a><a name="idd1e2028"></a><a name="idd1e2033"></a><a name="idd1e2036"></a><a name="idd1e2039"></a><a name="idd1e2042"></a><a name="idd1e2047"></a><a name="idd1e2050"></a><a name="idd1e2053"></a><a name="idd1e2058"></a><a name="idd1e2063"></a>language is notoriously difficult to use. Solaris, having its heritage in both BSD and System V, provides all the shells shown in <a class="docLink" href="#ch01fig02">Figure 1.2</a>. Free ports of most of the shells are available on the Internet.</p>
<p class="docText">Throughout the text, we will use parenthetical notes such as this to describe historical notes and to compare different implementations of the UNIX System. Often the reason for a particular implementation technique becomes clear when the historical reasons are described.</p>
</blockquote>
<p class="docText">Throughout this text, we'll show interactive shell examples to execute a program that we've developed. These examples use features common to the Bourne shell, the Korn shell, and the Bourne-again shell.</p>


<a href="17021535.html"><img src="images/pixel.gif" alt="" width="1" height="1" border="0"></a><ul></ul></td></tr></table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td><div STYLE="MARGIN-LEFT: 0.15in;"><a href="toc.html"><img src="images/team.gif" width="60" height="17" border="0" align="absmiddle"  alt="Team BBL"></a></div></td>
<td align="right"><div STYLE="MARGIN-LEFT: 0.15in;">
<a href=ch01lev1sec2.html><img src="images/prev.gif" width="60" height="17" border="0" align="absmiddle" alt="Previous Page"></a>
<a href=ch01lev1sec4.html><img src="images/next.gif" width="60" height="17" border="0" align="absmiddle" alt="Next Page"></a>
</div></td></tr></table>
</body></html><br>
<table width="100%" cellspacing="0" cellpadding="0"
style="margin-top: 0pt; border-collapse: collapse;"> 
<tr> <td align="right" style="background-color=white; border-top: 1px solid gray;"> 
<a href="http://www.zipghost.com/" target="_blank" style="font-family: Tahoma, Verdana;
 font-size: 11px; text-decoration: none;">The CHM file was converted to HTM by Trial version of <b>ChmD<!--255-->ecompiler</b>.</a>
</TD>
</TR><tr>
<td align="right" style="background-color=white; "> 
<a href="http://www.etextwizard.com/download/cd/cdsetup.exe" target="_blank" style="font-family: Tahoma, Verdana;
 font-size: 11px; text-decoration: none;">Download <b>ChmDec<!--255-->ompiler</b> at: http://www.zipghost.com</a>
</TD></tr></table>
